package org.healthy.util;

import org.healthy.base.constant.ParamConst;
import org.healthy.model.TargetSet;
import org.healthy.model.TeamDynamic;
import org.healthy.model.User;
import org.healthy.model.WitnessCard;

/**
 * Created by qingshengzheng on 15/12/4.
 */
public class TeamDynamicUtil {

    /**
     * 生成加入小组动态
     *
     * @param uid
     * @param teamid
     * @return
     */
    public static TeamDynamic joinTeam(Long uid, Long teamid) {
        TeamDynamic dynamic = new TeamDynamic();
        dynamic.pubtime = System.currentTimeMillis();
        dynamic.srcuser.uid = uid;
        dynamic.uid = uid;
        dynamic.teamid = teamid;
        dynamic.dynamictype = ParamConst.TEAM_DYNAMIC_TYPE_JOIN;
        return dynamic;
    }

    /**
     * 退出小组动态
     *
     * @param uid
     * @param teamid
     * @return
     */
    public static TeamDynamic quitTeam(Long uid, Long teamid) {
        TeamDynamic dynamic = new TeamDynamic();
        dynamic.pubtime = System.currentTimeMillis();
        dynamic.srcuser.uid = uid;
        dynamic.uid = uid;
        dynamic.teamid = teamid;
        dynamic.dynamictype = ParamConst.TEAM_DYNAMIC_TYPE_QUIT;
        return dynamic;
    }

    public static TeamDynamic targetSet(Long uid,TargetSet set)
    {
        TeamDynamic dynamic=new TeamDynamic();
        dynamic.pubtime=System.currentTimeMillis();
        dynamic.targetSet=set;
        dynamic.srcuser.uid = uid;
        dynamic.uid=uid;
        dynamic.teamid=set.teamid;
        dynamic.dynamictype=ParamConst.TEAM_DYNAMIC_TYPE_TARGET_SET;
        return dynamic;
    }

    public static  TeamDynamic completeTarget(Long uid,TargetSet set)
    {
        TeamDynamic dynamic=new TeamDynamic();
        dynamic.pubtime=System.currentTimeMillis();
        dynamic.srcuser.uid = uid;
        dynamic.uid=uid;
        dynamic.teamid=set.teamid;
        dynamic.targetSet=set;
        dynamic.dynamictype=ParamConst.TEAM_DYNAMIC_TYPE_COMPLETE_TARGET;
        return dynamic;

    }


    /**
     * 发布见证卡片
     * @param card
     * @return
     */
    public static TeamDynamic pubWitness(WitnessCard card) {
        TeamDynamic dynamic = new TeamDynamic();
        dynamic.pubtime = System.currentTimeMillis();
        dynamic.uid = card.uid;
        dynamic.srcuser.uid = card.uid;
        dynamic.teamid = card.teamid;
        dynamic.dynamictype = ParamConst.TEAM_DYNAMIC_TYPE_PUB_WITNESS;
        dynamic.witnessCard = card;
        return dynamic;
    }
    /**
     * 好友见证
     *
     * @param srcuid
     * @param touid
     * @param teamid
     * @return
     */
    public static TeamDynamic witness(Long srcuid, Long touid, Long teamid, Long love_score, Long social_score, Long energy_score, Long intell_score) {
        TeamDynamic dynamic = new TeamDynamic();
        dynamic.pubtime = System.currentTimeMillis();
        dynamic.srcuser.uid = srcuid;
        dynamic.teamid = teamid;
        dynamic.dynamictype = ParamConst.TEAM_DYNAMIC_TYPE_PUB_WITNESS;
        dynamic.toUser.uid = touid;
        dynamic.love_score = love_score;
        dynamic.social_score = social_score;
        dynamic.energy_score = energy_score;
        dynamic.intell_score = intell_score;
        return dynamic;
    }

}
